<?php
/**
 * 获取终端报表数据（pc版与手机版上的投注数据）
 */
function getSourceData($param){
    global $db;
    // 组合查询条件
    $where = ' WHERE 1 ';
    if($param['search_btime']) $btime = ' AND dateline >= ' . strtotime($param['search_btime']);
    if($param['search_etime']) $etime = ' AND dateline <= ' . strtotime($param['search_etime']);
    if (!$btime){
        $btime = ' AND dateline >= ' . strtotime( date('Y-m-d', strtotime('-1 day')) );
    }
    $where .= $btime . $etime;
    $sourceTab = Table('statistic_source');
    $sql = 'SELECT platform, bet_user, reg_nums, recharge_nums, recharge_amount, cash_amount, bet_amount, prize_amount, 
            bet_orders, profit, profit_raft, dateline FROM ' . $sourceTab . $where;
    $res = $db->getall($sql);
    return $res;
}